#!/usr/bin/env python
from astropy.table import Table
import numpy as np
import sys

wave = int(sys.argv[2])
aux_wave = int(sys.argv[3])

tab = Table.read("ptc_result.tab",format='ipac')
tab1 = tab[(tab['wave'] >= wave-30)*(tab['wave'] <= wave+30)]
tab1.write("ptc_result_main_"+str(wave)+".tab",format='ipac',overwrite=True)

tab2 = tab[(tab['wave']==aux_wave)]
tab2 = tab2[tab2['wave']==tab2['wave'][0]]
tab2.write("ptc_result_aux_"+str(aux_wave)+".tab",format='ipac',overwrite=True)
